<template>
<view class="">
	<phone-directory :phones="phones" @paramClick="paramClick" class="phone"></phone-directory>
		
</view>
</template>

<script>
    var _self;
	import phoneDirectory from '@/components/phones/phone-directory.vue'
	export default{
		data(){
			return{
				phones:{},
				action:'noaction',		
			}
		},
		mounted() {
			
		},
		onLoad(e){
			_self = this
			this.getphones()
			if(e.action == 'publish'){
				_self.action = 'publish'
			}
		},
		methods:{
			paramClick (e) {
				if(_self.action == 'publish'){				
					uni.navigateBack({
					    delta: 2
					});										
				}else{
					uni.navigateBack({
					    delta: 1
					});
				}
				this.$eventHub.$emit('fire',[e.id,e.name]);
			},
			getphones(){
				uni.request({
					url: this.websiteUrl+'/api.php/friends/connections',
					method: 'POST',
					header: {
						'content-type':'application/x-www-form-urlencoded',						
					},
					data: {token:uni.getStorageSync('token')},
					success:function(res){
						_self.phones = res.data.data
					
					},
					
				});
			}
			
		},
		onNavigationBarButtonTap(e){
			uni.navigateTo({			
				url:'/pages/me/content/addLord'
			})
		},
		components:{
			phoneDirectory
		}
	}
</script>

<style>
	
</style>
